package com.rongmei.jdsync.dto;

import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * SKU规格数据传输对象
 */
@Data
@Schema(description = "SKU规格")
public class SkuSpecDto {
    @Schema(description = "规格名称")
    private String name;

    @JsonProperty("spec_id")
    @Schema(description = "规格ID")
    private Integer specId;

    @Schema(description = "规格值列表")
    private List<SkuSpecValueDto> value;

    // 处理额外的属性
    private Map<String, Object> additionalProperties = new HashMap<>();

    @JsonAnyGetter
    public Map<String, Object> getAdditionalProperties() {
        return additionalProperties;
    }

    @JsonAnySetter
    public void setAdditionalProperty(String name, Object value) {
        additionalProperties.put(name, value);
    }
}
